package com.tsunami.message.controller;

import com.tsunami.message.entity.Mail;
import com.tsunami.message.service.impl.ProduceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lx
 * @date 2024-09-19
 */

@RestController
public class MailController {
    @Autowired
    private ProduceService produceService;

    @PostMapping("sendMail")
    public String sendMail(Mail mail) {
        boolean result = produceService.sendByAck(mail);
        return result ? "success": "fail";
    }


    @PostMapping("sendMailToDB")
    public String sendMailToDB(Mail mail) {
        boolean result = produceService.sendByAuto(mail);
        return result ? "success": "fail";
    }
}
